Main Page   File List  

[g]ReadConfirm---ReadRequest.h

00001 //   Read Confirm and Read Request
00002 
00003 case L2CA_Service_Union_Read_tag: {
00004         int i;
00005                 
00006         /*[jtt] Check if Read Confirm(Should be!!!), (from L2CAP)
00007         1)Extract String from Payload, 
00008         2)Put it into "out_String" variable,
00009         3)Put "out_String" into "Output_Post(out_String);" and sent it!
00010         4)Last prepare for another 'Read Request' command and send it to L2CAP.
00011          by setting up the "tag" part and do "L2CA_Packet_Out_Post(&L2CA_Packet_out);" 
00012         */
00013 
00014         /*Print useful message to Analysis Output window */
00015         if(IsMaster_Value())
00016                 vccPrintPdxDebugInfo("%_START_ MASTER : GBI ->received [Read_Confirm] from LL - return Read_Request %_END_");
00017         else
00018                 vccPrintPdxDebugInfo("%_START_ SLAVE  : GBI ->received [Read_Confirm] from LL - return Read_Request %_END_");
00019 
00020         /*Receives ReadCfm(meaning a Write on the other device), reply with L2CA_Read_Union_Request_tag */
00021         /* Output Parameters - Result and N */
00022         Result     = L2CA_packet_in->Service.__union.Read.__union.Result.Result;/*0x0000=Success, 0x0001=Unsuccessful */
00023         N          = L2CA_packet_in->Service.__union.Read.__union.Result.N; /*no. of bytes transferred to InBuffer */
00024                         
00025         /* Read string from InBuffer and store it into out_String. */
00026         for(i = 0; i < N; i++){
00027                 out_String[i] = L2CA_packet_in->Service.__union.Read.__union.Result.InBuffer[i]; /* Integer[2000] */
00028         }               
00029         out_String[N] = 0;
00030 
00031         /*3 - send String to NET module */
00032         Output_Post(out_String);
00033 
00034         /*Print useful message to Analysis Output window */
00035         if(IsMaster_Value())
00036                 vccPrintPdxDebugInfo("%_START_ MASTER : GBI -Read ->sent [%s] to NET %_END_", out_String);
00037         else
00038                 vccPrintPdxDebugInfo("%_START_ SLAVE  : GBI -Read ->sent [%s] to NET %_END_", out_String);
00039 
00040         /*4 - from L2CA_Service_Union_Configure_tag above*/
00041         /* Setup L2CAP for Data Read - Set Tag for Read_Union_Request and Contents. */
00042         L2CA_packet_out.Service.__unionTag = L2CA_Service_Union_Read_tag;
00043         L2CA_packet_out.Service.__union.Read.__unionTag = L2CA_Read_Union_Request_tag;
00044         
00045         L2CA_packet_out.SourceID = 0x02;
00046         L2CA_packet_out.Service.__union.Read.__union.Request.CID = CID;  /* 0x05 */
00047         L2CA_packet_out.Service.__union.Read.__union.Request.Length = 1504;
00048                                 
00049         L2CA_Packet_Out_Post(&L2CA_packet_out);
00050         
00051         /*Print useful message to Analysis Output window */
00052         if(IsMaster_Value())
00053                 vccPrintPdxDebugInfo("%_START_ MASTER : GBI -Read ->sent [Read_Request] to LL %_END_");
00054         else
00055                 vccPrintPdxDebugInfo("%_START_ SLAVE  : GBI -Read ->sent [Read_Request] to LL %_END_");
00056 
00057         break;
00058 }

Generated on Sun May 12 19:02:34 2002 by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002